home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 1998 November / IRIX 6.5.2 Base Documentation November 1998.img / usr / share / catman / u_man / cat1 / X11 / xcalc.z / xcalc
Text File  |  1998-10-30  |  25KB  |  529 lines

  1.  
  2.  
  3.  
  4.      XXXXCCCCAAAALLLLCCCC((((1111))))            XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((RRRReeeelllleeeeaaaasssseeee 5555))))             XXXXCCCCAAAALLLLCCCC((((1111))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.           xcalc - scientific calculator for X
  10.  
  11.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.           xxxxccccaaaallllcccc [-stipple] [-rpn] [-_t_o_o_l_k_i_t_o_p_t_i_o_n...]
  13.  
  14.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  15.           _x_c_a_l_c is a scientific calculator desktop accessory that can
  16.           emulate a TI-30 or an HP-10C.
  17.  
  18.      OOOOPPPPTTTTIIIIOOOONNNNSSSS
  19.           _x_c_a_l_c accepts all of the standard toolkit command line
  20.           options along with two additional options:
  21.  
  22.           ----ssssttttiiiipppppppplllleeee
  23.                   This option indicates that the background of the
  24.                   calculator should be drawn using a stipple of the
  25.                   foreground and background colors.  On monochrome
  26.                   displays improves the appearance.
  27.  
  28.           ----rrrrppppnnnn    This option indicates that Reverse Polish Notation
  29.                   should be used.  In this mode the calculator will
  30.                   look and behave like an HP-10C.  Without this flag,
  31.                   it will emulate a TI-30.
  32.  
  33.      OOOOPPPPEEEERRRRAAAATTTTIIIIOOOONNNN
  34.           _P_o_i_n_t_e_r _U_s_a_g_e: Operations may be performed with pointer
  35.           button 1, or in some cases, with the keyboard. Many common
  36.           calculator operations have keyboard accelerators.  To quit,
  37.           press pointer button 3 on the AC key of the TI calculator,
  38.           or the ON key of the HP calculator.
  39.  
  40.           _C_a_l_c_u_l_a_t_o_r _K_e_y _U_s_a_g_e (_T_I _m_o_d_e): The numbered keys, the +/-
  41.           key, and the +, -, *, /, and = keys all do exactly what you
  42.           would expect them to.  It should be noted that the operators
  43.           obey the standard rules of precedence.  Thus, entering
  44.           "3+4*5=" results in "23", not "35".  The parentheses can be
  45.           used to override this.  For example, "(1+2+3)*(4+5+6)="
  46.           results in "6*15=90".
  47.  
  48.           The entire number in the calculator display can be selected,
  49.           in order to paste the result of a calculation into text.
  50.  
  51.           The action procedures associated with each function are
  52.           given below.  These are useful if you are interested in
  53.           defining a custom calculator.  The action used for all digit
  54.           keys is ddddiiiiggggiiiitttt((((_n)))), where _n is the corresponding digit, 0..9.
  55.  
  56.           1111////xxxx       Replaces the number in the display with its
  57.                     reciprocal.  The corresponding action procedure is
  58.                     rrrreeeecccciiiipppprrrrooooccccaaaallll(((()))).
  59.  
  60.  
  61.  
  62.  
  63.      Page 1                                          (printed 4/30/98)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      XXXXCCCCAAAALLLLCCCC((((1111))))            XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((RRRReeeelllleeeeaaaasssseeee 5555))))             XXXXCCCCAAAALLLLCCCC((((1111))))
  71.  
  72.  
  73.  
  74.           xxxx^^^^2222       Squares the number in the display.  The
  75.                     corresponding action procedure is ssssqqqquuuuaaaarrrreeee(((()))).
  76.  
  77.           SSSSQQQQRRRRTTTT      Takes the square root of the number in the
  78.                     display.  The corresponding action procedure is
  79.                     ssssqqqquuuuaaaarrrreeeeRRRRooooooootttt(((()))).
  80.  
  81.           CCCCEEEE////CCCC      When pressed once, clears the number in the
  82.                     display without clearing the state of the machine.
  83.                     Allows you to re-enter a number if you make a
  84.                     mistake.  Pressing it twice clears the state,
  85.                     also.  The corresponding action procedure for TI
  86.                     mode is cccclllleeeeaaaarrrr(((()))).
  87.  
  88.           AAAACCCC        Clears the display, the state, and the memory.
  89.                     Pressing it with the third pointer button turns
  90.                     off the calculator, in that it exits the program.
  91.                     The action procedure to clear the state is ooooffffffff(((())));
  92.                     to quit, qqqquuuuiiiitttt(((()))).
  93.  
  94.           IIIINNNNVVVV       Invert function.  See the individual function keys
  95.                     for details.  The corresponding action procedure
  96.                     is iiiinnnnvvvveeeerrrrsssseeee(((()))).
  97.  
  98.           ssssiiiinnnn       Computes the sine of the number in the display, as
  99.                     interpreted by the current DRG mode (see DRG,
  100.                     below).  If inverted, it computes the arcsine.
  101.                     The corresponding action procedure is ssssiiiinnnneeee(((()))).
  102.  
  103.           ccccoooossss       Computes the cosine, or arccosine when inverted.
  104.                     The corresponding action procedure is ccccoooossssiiiinnnneeee(((()))).
  105.  
  106.           ttttaaaannnn       Computes the tangent, or arctangent when inverted.
  107.                     The corresponding action procedure is ttttaaaannnnggggeeeennnntttt(((()))).
  108.  
  109.           DDDDRRRRGGGG       Changes the DRG mode, as indicated by 'DEG',
  110.                     'RAD', or 'GRAD' at the bottom of of the
  111.                     calculator ``liquid crystal'' display.  When in
  112.                     'DEG' mode, numbers in the display are taken as
  113.                     being degrees.  In 'RAD' mode, numbers are in
  114.                     radians, and in 'GRAD' mode, numbers are in grads.
  115.                     When inverted, the DRG key has a feature of
  116.                     converting degrees to radians to grads and vice-
  117.                     versa.  Example:  put the calculator into 'DEG'
  118.                     mode, and enter "45 INV DRG".  The display should
  119.                     now show something along the lines of ".785398",
  120.                     which is 45 degrees converted to radians.  The
  121.                     corresponding action procedure is ddddeeeeggggrrrreeeeeeee(((()))).
  122.  
  123.           eeee         The constant 'e'.  (2.7182818...).  The
  124.                     corresponding action procedure is eeee(((()))).
  125.  
  126.  
  127.  
  128.  
  129.      Page 2                                          (printed 4/30/98)
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      XXXXCCCCAAAALLLLCCCC((((1111))))            XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((RRRReeeelllleeeeaaaasssseeee 5555))))             XXXXCCCCAAAALLLLCCCC((((1111))))
  137.  
  138.  
  139.  
  140.           EEEEEEEE        Used for entering exponential numbers.  For
  141.                     example, to get "-2.3E-4" you'd enter "2 . 3 +/-
  142.                     EE 4 +/-".  The corresponding action procedure is
  143.                     sssscccciiiieeeennnnttttiiiiffffiiiicccc(((()))).
  144.  
  145.           lllloooogggg       Calculates the log (base 10) of the number in the
  146.                     display.  When inverted, it raises "10.0" to the
  147.                     number in the display.  For example, entering "3
  148.                     INV log" should result in "1000".  The
  149.                     corresponding action procedure is llllooooggggaaaarrrriiiitttthhhhmmmm(((()))).
  150.  
  151.           llllnnnn        Calculates the log (base e) of the number in the
  152.                     display.  When inverted, it raises "e" to the
  153.                     number in the display.  For example, entering "e
  154.                     ln" should result in "1".  The corresponding
  155.                     action procedure is nnnnaaaattttuuuurrrraaaallllLLLLoooogggg(((()))).
  156.  
  157.           yyyy^^^^xxxx       Raises the number on the left to the power of the
  158.                     number on the right.  For example "2 y^x 3 ="
  159.                     results in "8", which is 2^3.  For a further
  160.                     example, "(1+2+3) y^x (1+2) =" equals "6 y^x 3"
  161.                     which equals "216".  The corresponding action
  162.                     procedure is ppppoooowwwweeeerrrr(((()))).
  163.  
  164.           PPPPIIII        The constant 'pi'.  (3.1415927....)  The
  165.                     corresponding action procedure is ppppiiii(((()))).
  166.  
  167.           xxxx!!!!        Computes the factorial of the number in the
  168.                     display.  The number in the display must be an
  169.                     integer in the range 0-500, though, depending on
  170.                     your math library, it might overflow long before
  171.                     that.  The corresponding action procedure is
  172.                     ffffaaaaccccttttoooorrrriiiiaaaallll(((()))).
  173.  
  174.           ((((         Left parenthesis.  The corresponding action
  175.                     procedure for TI calculators is lllleeeeffffttttPPPPaaaarrrreeeennnn(((()))).
  176.  
  177.           ))))         Right parenthesis.  The corresponding action
  178.                     procedure for TI calculators is rrrriiiigggghhhhttttPPPPaaaarrrreeeennnn(((()))).
  179.  
  180.           ////         Division.  The corresponding action procedure is
  181.                     ddddiiiivvvviiiiddddeeee(((()))).
  182.  
  183.           ****         Multiplication.  The corresponding action
  184.                     procedure is mmmmuuuullllttttiiiippppllllyyyy(((()))).
  185.  
  186.           ----         Subtraction.  The corresponding action procedure
  187.                     is ssssuuuubbbbttttrrrraaaacccctttt(((()))).
  188.  
  189.           ++++         Addition.  The corresponding action procedure is
  190.                     aaaadddddddd(((()))).
  191.  
  192.  
  193.  
  194.  
  195.      Page 3                                          (printed 4/30/98)
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.      XXXXCCCCAAAALLLLCCCC((((1111))))            XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((RRRReeeelllleeeeaaaasssseeee 5555))))             XXXXCCCCAAAALLLLCCCC((((1111))))
  203.  
  204.  
  205.  
  206.           ====         Perform calculation.  The TI-specific action
  207.                     procedure is eeeeqqqquuuuaaaallll(((()))).
  208.  
  209.           SSSSTTTTOOOO       Copies the number in the display to the memory
  210.                     location.  The corresponding action procedure is
  211.                     ssssttttoooorrrreeee(((()))).
  212.  
  213.           RRRRCCCCLLLL       Copies the number from the memory location to the
  214.                     display.  The corresponding action procedure is
  215.                     rrrreeeeccccaaaallllllll(((()))).
  216.  
  217.           SSSSUUUUMMMM       Adds the number in the display to the number in
  218.                     the memory location.  The corresponding action
  219.                     procedure is ssssuuuummmm(((()))).
  220.  
  221.           EEEEXXXXCCCC       Swaps the number in the display with the number in
  222.                     the memory location.  The corresponding action
  223.                     procedure for the TI calculator is eeeexxxxcccchhhhaaaannnnggggeeee(((()))).
  224.  
  225.           ++++////----       Negate; change sign.  The corresponding action
  226.                     procedure is nnnneeeeggggaaaatttteeee(((()))).
  227.  
  228.           ....         Decimal point.  The action procedure is ddddeeeecccciiiimmmmaaaallll(((()))).
  229.  
  230.  
  231.           _C_a_l_c_u_l_a_t_o_r _K_e_y _U_s_a_g_e (_R_P_N _m_o_d_e): The number keys, CHS
  232.           (change sign), +, -, *, /, and ENTR keys all do exactly what
  233.           you would expect them to do.  Many of the remaining keys are
  234.           the same as in TI mode.  The differences are detailed below.
  235.           The action procedure for the ENTR key is eeeennnntttteeeerrrr(((()))).
  236.  
  237.  
  238.           <<<<----        This is a backspace key that can be used if you
  239.                     make a mistake while entering a number.  It will
  240.                     erase digits from the display.  (See BUGS).
  241.                     Inverse backspace will clear the X register.  The
  242.                     corresponding action procedure is bbbbaaaacccckkkk(((()))).
  243.  
  244.           OOOONNNN        Clears the display, the state, and the memory.
  245.                     Pressing it with the third pointer button turns
  246.                     off the calculator, in that it exits the program.
  247.                     To clear state, the action procedure is ooooffffffff; to
  248.                     quit, qqqquuuuiiiitttt(((()))).
  249.  
  250.           IIIINNNNVVVV       Inverts the meaning of the function keys.  This
  251.                     would be the  _f key on an HP calculator, but _x_c_a_l_c
  252.                     does not display multiple legends on each key.
  253.                     See the individual function keys for details.
  254.  
  255.           11110000^^^^xxxx      Raises "10.0" to the number in the top of the
  256.                     stack. When inverted, it calculates the log (base
  257.                     10) of the number in the display.  The
  258.  
  259.  
  260.  
  261.      Page 4                                          (printed 4/30/98)
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.      XXXXCCCCAAAALLLLCCCC((((1111))))            XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((RRRReeeelllleeeeaaaasssseeee 5555))))             XXXXCCCCAAAALLLLCCCC((((1111))))
  269.  
  270.  
  271.  
  272.                     corresponding action procedure is tttteeeennnnppppoooowwwweeeerrrr(((()))).
  273.  
  274.           eeee^^^^xxxx       Raises "e" to the number in the top of the stack.
  275.                     When inverted, it calculates the log (base e) of
  276.                     the number in the display.  The action procedure
  277.                     is eeeeppppoooowwwweeeerrrr(((()))).
  278.  
  279.           SSSSTTTTOOOO       Copies the number in the top of the stack to a
  280.                     memory location.  There are 10 memory locations.
  281.                     The desired memory is specified by following this
  282.                     key with a digit key.
  283.  
  284.           RRRRCCCCLLLL       Pushes the number from the specified memory
  285.                     location onto the stack.
  286.  
  287.           SSSSUUUUMMMM       Adds the number on top of the stack to the number
  288.                     in the specified memory location.
  289.  
  290.           xxxx::::yyyy       Exchanges the numbers in the top two stack
  291.                     positions, the X and Y registers.  The
  292.                     corresponding action procedure is XXXXeeeexxxxcccchhhhaaaannnnggggeeeeYYYY(((()))).
  293.  
  294.           RRRR vvvv       Rolls the stack downward.  When inverted, it rolls
  295.                     the stack upward.  The corresponding action
  296.                     procedure is rrrroooollllllll(((()))).
  297.  
  298.           _b_l_a_n_k     These keys were used for programming functions on
  299.                     the HP-10C.  Their functionality has not been
  300.                     duplicated in _x_c_a_l_c.
  301.  
  302.           Finally, there are two additional action procedures:
  303.           bbbbeeeellllllll(((()))), which rings the bell; and sssseeeelllleeeeccccttttiiiioooonnnn(((()))), which
  304.           performs a cut on the entire number in the calculator's
  305.           ``liquid crystal'' display.
  306.  
  307.      AAAACCCCCCCCEEEELLLLEEEERRRRAAAATTTTOOOORRRRSSSS
  308.           Accelerators are shortcuts for entering commands.  _x_c_a_l_c
  309.           provides some sample keyboard accelerators; also users can
  310.           customize accelerators.  The numeric keypad accelerators
  311.           provided by _x_c_a_l_c should be intuitively correct.  The
  312.           accelerators defined by _x_c_a_l_c on the main keyboard are given
  313.           below:
  314.  
  315.                TI Key    HP Key    Keyboard Accelerator     TI Function    HP Function
  316.  
  317.                SQRT SQRT r              squareRoot()   squareRoot()
  318.                AC   ON   space               clear()        clear()
  319.                AC   <-   Delete              clear()        back()
  320.                AC   <-   Backspace      clear()        back()
  321.                AC   <-   Control-H      clear()        back()
  322.                AC        Clear               clear()
  323.                AC   ON   q              quit()         quit()
  324.  
  325.  
  326.  
  327.      Page 5                                          (printed 4/30/98)
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.      XXXXCCCCAAAALLLLCCCC((((1111))))            XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((RRRReeeelllleeeeaaaasssseeee 5555))))             XXXXCCCCAAAALLLLCCCC((((1111))))
  335.  
  336.  
  337.  
  338.                AC   ON   Control-C      quit()         quit()
  339.  
  340.                INV  i    i              inverse()      inverse()
  341.                sin  s    s              sine()         sine()
  342.                cos  c    c              cosine()       cosine()
  343.                tan  t    t              tangent() tangent()
  344.                DRG  DRG  d              degree()       degree()
  345.  
  346.                e         e              e()
  347.                ln   ln   l              naturalLog()   naturalLog()
  348.                y^x  y^x  ^              power()        power()
  349.  
  350.                PI   PI   p              pi()      pi()
  351.                x!   x!   !              factorial()    factorial()
  352.                (         (              leftParen()
  353.                )         )              rightParen()
  354.  
  355.                /    /    /              divide()       divide()
  356.                *    *    *              multiply()     multiply()
  357.                -    -    -              subtract()     subtract()
  358.                +    +    +              add()          add()
  359.                =         =              equal()
  360.  
  361.                0..9 0..9 0..9           digit()        digit()
  362.                .    .    .              decimal() decimal()
  363.                +/-  CHS  n              negate()       negate()
  364.  
  365.                     x:y  x                        XexchangeY()
  366.                     ENTR Return                        enter()
  367.                     ENTR Linefeed                      enter()
  368.  
  369.      CCCCUUUUSSSSTTTTOOOOMMMMIIIIZZZZAAAATTTTIIIIOOOONNNN
  370.           The application class name is XCalc.
  371.  
  372.           _x_c_a_l_c has an enormous application defaults file which
  373.           specifies the position, label, and function of each key on
  374.           the calculator.  It also gives translations to serve as
  375.           keyboard accelerators.  Because these resources are not
  376.           specified in the source code, you can create a customized
  377.           calculator by writing a private application defaults file,
  378.           using the Athena Command and Form widget resources to
  379.           specify the size and position of buttons, the label for each
  380.           button, and the function of each button.
  381.  
  382.           The foreground and background colors of each calculator key
  383.           can be individually specified.  For the TI calculator, a
  384.           classical color resource specification might be:
  385.  
  386.           XCalc.ti.Command.background:  gray50
  387.           XCalc.ti.Command.foreground:  white
  388.  
  389.           For each of buttons 20, 25, 30, 35, and 40, specify:
  390.  
  391.  
  392.  
  393.      Page 6                                          (printed 4/30/98)
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.      XXXXCCCCAAAALLLLCCCC((((1111))))            XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((RRRReeeelllleeeeaaaasssseeee 5555))))             XXXXCCCCAAAALLLLCCCC((((1111))))
  401.  
  402.  
  403.  
  404.           XCalc.ti.button20.background: black
  405.           XCalc.ti.button20.foreground: white
  406.  
  407.           For each of buttons 22, 23, 24, 27, 28, 29, 32, 33, 34, 37,
  408.           38, and 39:
  409.           XCalc.ti.button22.background: white
  410.           XCalc.ti.button22.foreground: black
  411.  
  412.      WWWWIIIIDDDDGGGGEEEETTTT HHHHIIIIEEEERRRRAAAARRRRCCCCHHHHYYYY
  413.           In order to specify resources, it is useful to know the
  414.           hierarchy of the widgets which compose _x_c_a_l_c.  In the
  415.           notation below, indentation indicates hierarchical
  416.           structure.  The widget class name is given first, followed
  417.           by the widget instance name.
  418.  
  419.           XCalc xcalc
  420.                Form  ti  _o_r  hp    (_t_h_e _n_a_m_e _d_e_p_e_n_d_s _o_n _t_h_e _m_o_d_e)
  421.                     Form  bevel
  422.                          Form  screen
  423.                               Label  M
  424.                               Toggle  LCD
  425.                               Label  INV
  426.                               Label  DEG
  427.                               Label  RAD
  428.                               Label  GRAD
  429.                               Label  P
  430.                     Command  button1
  431.                     Command  button2
  432.                     Command  button3
  433.           _a_n_d _s_o _o_n, ...
  434.                     Command  button38
  435.                     Command  button39
  436.                     Command  button40
  437.  
  438.      AAAAPPPPPPPPLLLLIIIICCCCAAAATTTTIIIIOOOONNNN RRRREEEESSSSOOOOUUUURRRRCCCCEEEESSSS
  439.           rrrrppppnnnn (Class RRRRppppnnnn)
  440.                   Specifies that the rpn mode should be used.  The
  441.                   default is TI mode.
  442.  
  443.           ssssttttiiiipppppppplllleeee (Class SSSSttttiiiipppppppplllleeee)
  444.                   Indicates that the background should be stippled.
  445.                   The default is ``on'' for monochrome displays, and
  446.                   ``off'' for color displays.
  447.  
  448.           ccccuuuurrrrssssoooorrrr (Class CCCCuuuurrrrssssoooorrrr)
  449.                   The name of the symbol used to represent the
  450.                   pointer.  The default is ``hand2''.
  451.  
  452.      CCCCOOOOLLLLOOOORRRRSSSS
  453.           If you would like xcalc to use its ti colors, include the
  454.           following in the #ifdef COLOR section of the file you read
  455.           with xrdb:
  456.  
  457.  
  458.  
  459.      Page 7                                          (printed 4/30/98)
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.      XXXXCCCCAAAALLLLCCCC((((1111))))            XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((RRRReeeelllleeeeaaaasssseeee 5555))))             XXXXCCCCAAAALLLLCCCC((((1111))))
  467.  
  468.  
  469.  
  470.           *customization:                 -color
  471.  
  472.           This will cause xcalc to pick up the colors in the app-
  473.           defaults color customization file:  /usr/lib/X11/app-
  474.           defaults/XCalc-color.
  475.  
  476.      SSSSEEEEEEEE AAAALLLLSSSSOOOO
  477.           X(1), xrdb(1), the Athena Widget Set
  478.  
  479.      BBBBUUUUGGGGSSSS
  480.           HP mode:  A bug report claims that the sequence of keys 5,
  481.           ENTER, <- should clear the display, but it doesn't.
  482.  
  483.      CCCCOOOOPPPPYYYYRRRRIIIIGGGGHHHHTTTT
  484.           Copyright 1988, 1989, Massachusetts Institute of Technology.
  485.           See _X(_1) for a full statement of rights and permissions.
  486.  
  487.      AAAAUUUUTTTTHHHHOOOORRRRSSSS
  488.           John Bradley, University of Pennsylvania
  489.           Mark Rosenstein, MIT Project Athena
  490.           Donna Converse, MIT X Consortium
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.      Page 8                                          (printed 4/30/98)
  526.  
  527.  
  528.  
  529.